package leo.weixin.entity.message;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import leo.weixin.common.Const;
import leo.weixin.entity.Article;
import leo.weixin.entity.message.BaseMessage;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;
import java.util.Map;


/**
 * 图文消息
 * <xml>
 *   <ToUserName><![CDATA[toUser]]></ToUserName>
 *   <FromUserName><![CDATA[fromUser]]></FromUserName>
 *   <CreateTime>12345678</CreateTime>
 *   <MsgType><![CDATA[news]]></MsgType>
 *   <ArticleCount>1</ArticleCount>     //数量
 *   <Articles>
 *     <item>
 *       <Title><![CDATA[title1]]></Title>
 *       <Description><![CDATA[description1]]></Description>
 *       <PicUrl><![CDATA[picurl]]></PicUrl>
 *       <Url><![CDATA[url]]></Url>
 *     </item>
 *   </Articles>
 * </xml>
 */
@Data
@Accessors(chain = true)
@XStreamAlias("xml")
public class NewsMessage extends BaseMessage {
    @XStreamAlias("ArticleCount")
    private Integer articleCount = 1 ;
    @XStreamAlias("Articles")
    private List<Article> articles;
    public NewsMessage(Map<String,String> requestMap,List<Article> articles,Integer articleCount){
        super(requestMap);
        this.setMsgType(Const.MsgTypeEnum.NEWS);
        this.articleCount = articleCount;
        this.articles = articles;
    }
}
